﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Audio;

namespace Escape
{
    class FistBlock : SpriteBlock
    {

        bool took = false;
        SoundEffect sound;

        public FistBlock(Vector3 position, direction d)
            : base(position, d, Basic.content.Load<Texture2D>("HUD\\fist"))
        {
            sound = Basic.content.Load<SoundEffect>("Sounds\\fistPickUp");
            collision = false;
        }

        public override void use()
        {
            if (!took)
            {
                if (isInBlock(new Vector3(GameScreen.c.CameraPosition.X + 0.1f, 0, GameScreen.c.CameraPosition.Z + 0.1f)) ||
                    isInBlock(new Vector3(GameScreen.c.CameraPosition.X - 0.1f, 0, GameScreen.c.CameraPosition.Z - 0.1f)))
                {
                    if (ItemBar.setItemToNextZeroSlot(new FistItem()))
                    {
                        took = true;
                        sound.Play();
                        remove();
                    }
                }
            }
            base.use();
        }
    }
}
